<template>
  <view>
    <view class="" style="padding:30rpx;" v-for="(item ,index) in modelList" :index="index" :key="index">
      <view class="mainColor border-10" style="border: 1px solid #fff;">
        <view class="padding-10">
          型号名称：{{item.modelName}}
        </view>
        <view class="padding-10">额定功率：{{item.ratedPower || '一'}}kw</view>
        <view class="text padding-10">额定电流：{{item.ratedCurrent || '一'}}A</view>
        <view class="text padding-10">额定电压：{{item.ratedVoltage || '一'}}V</view>
        <view class=" padding-10">充电状态：{{speedType(item.speedType) }}</view>
        <view class=" padding-10">充电桩类型：{{deviceType(item.chargerPileType) }}</view>
        <!-- <view class="flex justify-between align-center padding-10">
          <view class="">站点类型：{{stationtype(item.stationType)}}</view>
          <view class="">站点状态：{{stationStatus(item.stationStatus )}}</view>
        </view> -->

        <view class="text padding-10">充电枪数量：{{item.connectorNum || '一'}}</view>
        <view class="text padding-10">充电接口标椎：{{item.interfaceStandard || '一'}}</view>
        <!--   <view class="text padding-10">操作：
          <text style="color: aqua;margin-right: 20rpx;" v-if="checkPermi(['pile:model:edit'])">修改</text>
          <text style="color: aqua;" v-if="checkPermi(['pile:model:remove'])">删除</text>
        </view> -->
        <!-- <view class="text padding-10">微信商户订单号：{{item.outTradeNo === null ? '一':item.outTradeNo}}</view> -->
      </view>
    </view>

    <!-- 分页 -->
    <uni-pagination show-icon :page-size="queryParams.pageSize" :current="queryParams.pageNum" :total="total"
      @change="change" />
    <view class="btn-view;mainColor border-10">
      <view class="">
        <text
          class="example-info">当前页：{{ queryParams.pageNum }}，数据总量：{{ total }}条，每页数据：{{ queryParams.pageSize }}</text>
      </view>
      <view class="btn-flex ">
        <button class="button word-btn" hover-class="word-btn--hover" :hover-start-time="20" :hover-stay-time="70"
          @click="add"><text class="word-btn-white">增加10条数据</text></button>
        <button class="button" type="default" @click="reset" style="margin-left: 40rpx;">重置数据</button>
      </view>
    </view>
  </view>
</template>

<script>
  import {
    checkPermi,
    checkRole
  } from "@/utils/permission";
  import {
    listModel
  } from '@/api/pile/model'
  import {
    speedType,
    deviceType,
    payStatus
  } from '@/common/dict.js'
  export default {
    props: ['stationId'],
    data() {
      return {
        speedTypeList: [],
        deviceTypeList: [],
        payStatusList: [],
        // 总条数
        total: 0,
        // 订单表格数据
        modelList: [],
        // 订单详情表格数据
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          modelName: null
        },
      };
    },
    methods: {
      checkPermi,
      checkRole,
      add() {
        this.queryParams.pageSize += 10
        this.getList();
      },
      reset() {
        this.queryParams.pageSize = 10
        this.queryParams.pageNum = 1
        this.getList();
      },
      change(e) {
        console.log(e.current);
        this.queryParams.pageNum = e.current
        this.getList()
      },
      deviceType(sim) {
        deviceType.then(result => {
          this.deviceTypeList = result
        })
        let str = this.deviceTypeList.find(item => item.dictValue == sim)
        if (str == undefined) {
          return '一'
        } else {
          return str.dictLabel
        }
      },
      payStatus(sim) {
        payStatus.then(result => {
          this.payStatusList = result
        })
        let str = this.payStatusList.find(item => item.dictValue == sim)
        if (str == undefined) {
          return '一'
        } else {
          return str.dictLabel
        }
      },
      speedType(sim) {
        speedType.then(result => {
          this.speedTypeList = result
        })
        let str = this.speedTypeList.find(item => item.dictValue == sim)
        if (str == undefined) {
          return '一'
        } else {
          return str.dictLabel
        }
      },
      getList() {
        listModel(this.queryParams).then(response => {
          this.modelList = response.rows;
          // console.log('this.modelList', this.modelList)
          this.total = response.total;
        });
      },
    },
    created() {
      this.getList()
    }
  }
</script>

<style lang="scss">

</style>